package parser.nodes;

import scanner.Token;
import static scanner.TokenType.*;

// IndexExpression = integer | ConstIdent
// ConstIdent = ident
public class IndexExpressionNode extends Node {

    private Token size;

    public IndexExpressionNode(Token size) {
        if (size.type() == INTEGER || size.type() == IDENTIFIER) {
            this.size = size;
        }
    }

    public Token getSize() {
        return size;
    }
    
    @Override
    public void print() {
        p("IndexExpression:");
        indent();
        if (size != null) {
            p(size);
        }
        unindent();
    }

    @Override
    public void abstractPrint() {
        if (size != null) {
            p(size);
        }
    }
}
